<?php
HBase::using('Backend.*');
HBase::using('Backend.Robot.*');

class backend_modules_edit extends HModule {
	public $data;
	
	function run() {		
		if (isset($_POST['flag'])) {
			self::process();
		}
		else {
			$this->data = HModules::getOne($_GET['id']);					
		}
	}
	
	function process() {
		$name = $_POST['tbxName'];
		if (HModules::update($_GET['id'], $name))
			HUtil::alert("Update module successfully!");
		else 
			HUtil::alert("ERROR! Module Name exists!");
		HUtil::redirect(HCommon::navigateUrl('Modules'));			
	}
}